package com.jxwifi.cloud.quickclean.adapter;

import android.graphics.Color;
import android.support.annotation.LayoutRes;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jxwifi.cloud.quickclean.R;
import com.jxwifi.cloud.quickclean.app.StateUtils;
import com.jxwifi.cloud.quickclean.bean.InRecordBean;
import com.jxwifi.cloud.quickclean.bean.QuickRecordBean;
import com.jxwifi.cloud.quickclean.bean.RecordsBean;

public class QucikListAdapter extends BaseQuickAdapter<RecordsBean, BaseViewHolder> {

    private String ProductPriceCode;

    public QucikListAdapter(@LayoutRes int layoutResId, String Product) {
        super(layoutResId, null);
        ProductPriceCode = Product;
    }

    @Override
    protected void convert(BaseViewHolder helper, RecordsBean item) {

        helper.setText(R.id.tv_fg_quick_time, item.getCreateTime());
        helper.setText(R.id.tv_fg_quick_title, item.getBillTitle());
        if (StateUtils.QUICK_RECHARGE.equals(ProductPriceCode)) { //购买记录
            helper.setText(R.id.tv_fg_quick_price, "+" + item.getTotalAmount() + "元");
            helper.setTextColor(R.id.tv_fg_quick_price, Color.parseColor("#3DB64D"));
        } else {  //消费记录
            if (StateUtils.ORDER_QT_OUT.equals(item.getBillType())){
                helper.setText(R.id.tv_fg_quick_price, "-" + item.getTotalAmount() + "元");
            }else if (StateUtils.ORDER_QT_ORDER_IN.equals(item.getBillType())){
                helper.setText(R.id.tv_fg_quick_price, "+" + item.getTotalAmount() + "元");
            }
            helper.setTextColor(R.id.tv_fg_quick_price, Color.parseColor("#333333"));
        }
//        helper.setText(R.id.tv_tool_kit_items_specifications, item.getSpecifications());
//        helper.setText(R.id.tv_tool_kit_items_price, "\u00A5" + String.valueOf(item.getToolprice()));
//        helper.setText(R.id.tv_buy_tool_kit_item_num, ""+item.getToolnum());
//        helper.addOnClickListener(R.id.cb_items_child).addOnClickListener(R.id.tv_buy_tool_kit_item_reduce).addOnClickListener(R.id.tv_buy_tool_kit_item_plus);
    }
}
